﻿using System;
using System.ComponentModel.DataAnnotations;
using LogManager.Base.Models.Event;

namespace LogManager.Base.Models.Filter
{
    /// <summary>
    /// A date filter does set a distinct time period with a start and an end
    /// </summary>
    public class EventDateRange : IEventDateRange
    {
        /// <summary>
        /// Create new default date filter (start is one month back and end is now)
        /// </summary>
        public EventDateRange()
        {
            Start = DateTime.Now.AddMonths(-1);
            End = DateTime.Now;
        }

        /// <summary>
        /// Create a new date filter with the given parameters
        /// </summary>
        /// <param name="start">Start of the distinct time period</param>
        /// <param name="end">End of the distinct time period</param>
        public EventDateRange(DateTime start, DateTime end)
        {
            Start = start;
            End = end;
        }
        
        /// <summary>
        /// End of the time period
        /// </summary>
        [DataType(DataType.DateTime)]
        [Display(Name = "Time Start")]
        public DateTime Start { get; set; }

        /// <summary>
        /// Start of the timeperiod
        /// </summary>
        [DataType(DataType.DateTime)]
        [Display(Name = "Time End")]
        public DateTime End { get; set; }
    }
}